Declarative Algorithms for Term Generation, Counting

نویسنده

  • Paul Tarau
چکیده

We design a declarative variant of Rémy’s algorithm, for uniform ran7 dom generation of binary trees. 8 Using the same basic mechanism as in the case of binary trees, we derive a gen9 eralization to term algebras of an arbitrary signature. With trees seen as sets of 10 edges connecting vertices labeled with logic variables, we use Prolog’s multiple11 answer generation mechanism to derive a generic algorithm that counts terms of 12 a given size, generates them all, or samples a random term given the signature of 13 a term algebra. 14 As applications, we implement generators for term algebras defining Motzkin 15 trees, use all-term and random-term generation for mutual cross-testing and de16 scribe an extension mechanism that transforms a random sampler for Motzkin 17 trees into one for closed lambda terms. 18

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

The Range Constraint: Algorithms and Implementation

We recently proposed a simple declarative language for specifying a wide range of counting and occurrence constraints. The language uses just two global primitives: the Range constraint, which computes the range of values used by a set of variables, and the Roots constraint, which computes the variables mapping onto particular values. In order for this specification language to be executable, p...

متن کامل

The Range and Roots Constraints: Algorithms and Implementation

We recently proposed a simple declarative language for specifying a wide range of counting and occurrence constraints. The language uses just two global primitives: the Range constraint, which computes the range of values used by a set of variables, and the Roots constraint, which computes the variables mapping onto particular values. In this paper, we demonstrate that this specification langua...

متن کامل

Different Methods of Long-Term Electric Load Demand Forecasting a Comprehensive Review

Long-term demand forecasting presents the first step in planning and developing future generation, transmission and distribution facilities. One of the primary tasks of an electric utility accurately predicts load demand requirements at all times, especially for long-term. Based on the outcome of such forecasts, utilities coordinate their resources to meet the forecasted demand using a least-co...

متن کامل

The Range and Roots Constraints: Specifying Counting and Occurrence Problems

We propose a simple declarative language for specifying a wide range of counting and occurrence constraints. This specification language is executable since it immediately provides a polynomial propagation algorithm. To illustrate the capabilities of this language, we specify a dozen global constraints taken from the literature. We observe one of three outcomes: we achieve generalized arc-consi...

متن کامل

On lambda-term skeletons, with applications to all-term and random-term generation of simply-typed closed lambda terms

Lambda terms in de Bruijn notation are Motzkin trees (also called binary-unary trees) with indices at their leaves counting up to a binder among the lambdas on the path to the root labeling their leaves. Define the skeleton of a lambda term as the Motzkin tree obtained by erasing the de Bruijn indices labeling their leaves. Then, given a Motzkin tree, one can ask if it is the skeleton of at lea...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2017